import os

def insert(connect, thing):
    cursor = connect.cursor()
#    cursor.execute('''create table thing
#                   (id INTEGER PRIMARY KEY AUTOINCREMENT, name text)''')
    cursor.execute("insert into thing values(?,?)", [thing.id, thing.name])
    connect.commit()
    
def load_files(connect, file, path):
    cursor = connect.cursor()
    cursor.execute('''create table if not exists files (id INTEGER PRIMARY KEY AUTOINCREMENT, name text)''')

    cursor.execute('''create table if not exists dirs (id INTEGER PRIMARY KEY AUTOINCREMENT, name text)''')
    
    for thing in file:
        if os.path.isfile(os.path.normpath(os.path.join(path, thing))):
            cursor.execute("insert into files values(NULL, ?)", [thing])
        else:
            cursor.execute("insert into dirs values(NULL, ?)", [thing])
     
    connect.commit()

 